from django.urls import path, include
from rest_framework.routers import DefaultRouter
from rest_framework.schemas import get_schema_view
from .views import (
    MCPServerViewSet, UserViewSet, register_user, login_user, logout_user, get_user,
    debug_oauth, reset_admin_password, delete_user, delete_all_users,
    ServerViewSet, parse_readme,
    CategoryListView,
    TagListView
)

# 创建路由器并注册视图集
router = DefaultRouter()
router.register(r'user-servers', MCPServerViewSet, basename='user-servers')
router.register(r'users', UserViewSet)
router.register(r'servers', ServerViewSet)

# 功能性API路径
urlpatterns = [
    path('', include(router.urls)),
    path('register/', register_user, name='register'),
    path('login/', login_user, name='login'),
    path('logout/', logout_user, name='logout'),
    path('user/', get_user, name='get-user'),
    path('debug-oauth/', debug_oauth, name='debug-oauth'),
    path('reset-admin-password/', reset_admin_password, name='reset-admin-password'),
    path('delete-user/<int:user_id>/', delete_user, name='delete-user'),
    path('delete-all-users/', delete_all_users, name='delete-all-users'),
    path('parse-readme/', parse_readme, name='parse-readme'),
    path('categories/', CategoryListView.as_view(), name='categories'),
    path('tags/', TagListView.as_view(), name='tags'),
] 